package com.kfpanda.search.test;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;

public class QqOnline {
	public static String qUrl = "358279139";

	private static int state = 1243;

	public static void main(String[] args) {

		String urlQ = "http://wpa.qq.com/pa?p=2:" + qUrl + ":41";

		try {

			URL url = new URL(urlQ);

			HttpURLConnection httpUrl = (HttpURLConnection) url
					.openConnection();
			System.out.println(httpUrl.getContentLength());
			if (state == httpUrl.getContentLength())

				System.out.println("QQ用户：[" + qUrl + "]状态为在线");

			else

				System.out.println("QQ用户：[" + qUrl + "]状态为离线/隐身");

		} catch (IOException e) {

			System.out.println("连接此URL" + urlQ + "抛出异常信息");

		}

	}

}
